package top.huiwow.managers;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class GamePlayerManager implements Listener {
    public Map<UUID, GamePlayer> gamePlayers = new HashMap<>();

    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        gamePlayers.put(e.getPlayer().getUniqueId(), new GamePlayer(e.getPlayer().getUniqueId()));
    }

    @EventHandler
    public void onDisconnect(PlayerQuitEvent e) {
        gamePlayers.remove(e.getPlayer().getUniqueId());
    }

    public GamePlayer get(UUID uuid) {
        return gamePlayers.get(uuid);
    }

}
